<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
          img{
            width: 2000px;
            height: 1000px;
       
          }
         
    </style>
</head>
  
<body>
    <!-- 点击按钮换图片 -->
    <img src="img/b1.jpg" id="imgId">
    <input type="button" value="点击"onclick="fn()">
    <script>
        function fn(){
            var imgDom=document.getElementById("imgId");
            var i=0;
            setInterval(function(){
                i++;
                if(i>5){
                    i=1
                }
                imgDom.src="img/b"+i+".jpg"
            },1000)
        }
    </script>
    
</body>

</html>